﻿//这个是布局js

(function ($) {
    //Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared   datatables-extensions.js
    //覆盖datetable 
    var localize = function (key) {
        return abp.localization.getResource('AbpUi')(key);
    };
    var datatables = abp.utils.createNamespace(abp, 'libs.datatables');
    var optionNormalizer = function () {

        var customizeRowActionColumn = function (column) {
            column.data = null;
            column.orderable = false;
            column.defaultContent = "";

            if (column.autoWidth === undefined) {
                column.autoWidth = false;
            }
        };

        datatables.normalizeConfiguration = function (configuration) {
            for (var i = 0; i < configuration.columnDefs.length; i++) {
                var column = configuration.columnDefs[i];
                if (!column.targets) {
                    column.targets = i;
                }

                if (column.rowAction) {
                    customizeRowActionColumn(column);
                }
            }

            configuration.language = {
                info: localize("PagerInfo"),
                infoFiltered: localize("PagerInfoFiltered"),
                infoEmpty: localize("PagerInfoEmpty"),
                search: localize("PagerSearch"),
                processing: localize("ProcessingWithThreeDot"),
                loadingRecords: localize("LoadingWithThreeDot"),
                lengthMenu: localize("PagerShowMenuEntries"),
                emptyTable: localize("NoDataAvailableInDatatable"),
                paginate: {
                    first: localize("PagerFirst"),
                    last: localize("PagerLast"),
                    previous: localize("PagerPrevious"),
                    next: localize("PagerNext")
                }
            };

            //设置成默认的就好
            //configuration.dom = '<"dataTable_filters"f>rt<"row dataTable_footer"<"col-auto"l><"col-auto"i><"col"p>>';

            return configuration;
        };

    }();

    //由于abp中用的dataTables.bootstrap4.js是旧的..
    var DataTable = $.fn.dataTable;
    $.extend(DataTable.ext.classes, {
        sWrapper: "dataTables_wrapper  dt-bootstrap4",
        sFilterInput: "form-control form-control-sm",
        sLengthSelect: "form-control form-control-sm",
        sProcessing: "dataTables_processing card",
        sPageButton: "paginate_button page-item"
    });


})(jQuery);
